import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
//注册三级连动组件，
import TypeNav from "@/components/TypeNav";
//注册轮播图组件
import Carsousel from "@/components/Carousel";
//引入全局样式
import "@/assets/css/index.css";
//引入mock
import "@/mock/mockServe.js";
//引入swiper
import "swiper/css/swiper.css";
//分液器
import Pagination from "@/components/Pagination";
import { MessageBox, Message } from "element-ui";
//引入图片懒加载组件
import VueLazyload from "vue-lazyload";
//表单验证组件
import "@/plugins/validate";
//注册全部组件
/**
 * TypeNav.name为组件名，在TypeNav定义的
 * TypeNav为引入的三级联动组件
 */
Vue.component("TypeNav", TypeNav);
Vue.component("Carsousel", Carsousel);
Vue.component("Pagination", Pagination);
Vue.config.productionTip = false;
Vue.prototype.$message = Message;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
//祖册图片懒加载组件
import loading from "@/assets/1.gif";
Vue.use(VueLazyload, {
  loading: loading,
});
import * as api from "@/api/index";

new Vue({
  beforeCreate() {
    //创建事件总线
    Vue.prototype.$bus = this;
    //把接口请求挂载到原型对象上，全局都可以使用
    Vue.prototype.$api = api;
  },
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
